﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    @*<script src="~/js/template.js"></script>*@
    <link rel="stylesheet" href="~/css/pintuer.css">
    <link rel="stylesheet" href="~/css/admin.css">
    <script src="~/js/jquery.js"></script>
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<form method="post" action="">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 留言管理</strong></div>
        <div class="padding border-bottom">
            <ul class="search">
                <li>
                    <button type="button" class="button border-green" id="checkall"><span class="icon-check"></span> 全选</button>
                    <button type="submit" class="button border-red"><span class="icon-trash-o"></span> 批量删除</button>
                </li>
            </ul>
        </div>



        <table class="table table-hover text-center" id="tab">
            <tr>
                <th width="120">ID</th>
                <th>商品编号</th>
                <th>商品名称</th>
                <th>商品价格</th>
                <th>购买数量</th>
                <th>添加时间</th>
                <th>状态</th>
                <th>操作</th>
            </tr>

            <tr v-for="item in mydata.items">
                <td>
                    <input type="checkbox" name="id[]" value="1" />
                    {{item.id}}
                </td>
                <td>{{item.orderCode}}</td>
                <td>{{item.orderId}}</td>
                <td>{{item.productId}}</td>
                <td>{{item.num}}</td>
                <td>{{item.unit}}</td>
                <td>{{item.type}}</td>
                <td>
                <div class="button-group"> 
                    <a v-bind:id="item.id"  v-bind:value="item.id" class="button border-red del" href="javascript:void(0)">
                    <span class="icon-trash-o"></span> 删除
                        </a> 
                    </div>
                </td>
            </tr>


            <tr>
                <td colspan="8"><div class="pagelist"> <a href="">上一页</a> <span class="current">1</span><a href="">2</a><a href="">3</a><a href="">下一页</a><a href="">尾页</a> </div></td>
            </tr>
        </table>


    </div>
</form>



<script>
    $(function () {

        var data = {
            items: [
                { 'id': 1, 'orderCode': 'BJxx01', "orderId": 1, "productId": 1, "num": 2, "unit": "个","type":1 },
                { 'id': 2, 'orderCode': 'BJxx01', "orderId": 1, "productId": 1, "num": 2, "unit": "个", "type": 1},
                { 'id': 3, 'orderCode': 'BJxx01', "orderId": 1, "productId": 1, "num": 2, "unit": "个", "type": 1}
            ]
        }

        var vm = new Vue({
            el: '#tab',
            data: {
                mydata: data
            },
            methods: {

                udelete: function (_id) //删除
                {
                },
                updateu: function (item) //更新
                {
                }
            }
        });



        // 获取删除按钮点击事件
        $(".del").click(function () {
            var val = $(this).attr("id");
            alert(val);
            //$(this).parent().remove();
            
        })


    })
</script>


<script type="text/javascript">

    function del() {
        if (confirm("您确定要删除吗?")) {
            //$("#tab tr td a").each(function () {
            //    //var d = this.id;
            //    alert($(this).val())
            //})

            var t = $(this).parent();
            alert(t)
           
        }
    }

    $("#checkall").click(function () {
        $("input[name='id[]']").each(function () {
            if (this.checked) {
                this.checked = false;
            }
            else {
                this.checked = true;
            }
        });
    })

    function DelSelect() {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {
            var t = confirm("您确认要删除选中的内容吗？");
            if (t == false) return false;
        }
        else {
            alert("请选择您要删除的内容!");
            return false;
        }
    }

</script>

</html>
